<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "{{%classify}}".
 *
 * @property int $id 分类ID
 * @property string $title 分类名称
 * @property int $parent_id 父分类ID
 * @property int $status 状态
 * @property int $created_at 创建时间
 * @property int $updated_at 更新时间
 */
class Classify extends Base
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%classify}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['title'],'required'],
            [['parent_id', 'status', 'created_at', 'updated_at'], 'integer'],
            [['title'], 'string', 'max' => 50],
        ];
    }

    /**
     * 设置可搜索列
     * @name: searchFields
     * @return array
     * @author: rickeryu <lhyfe1987@163.com>
     * @time: 2017/11/27 下午2:59
     */
    static function searchFields(){
        return ['title'];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => '分类ID',
            'title' => '分类名称',
            'parent_id' => '父分类ID',
            'status' => '状态',
            'created_at' => '创建时间',
            'updated_at' => '更新时间',
        ];
    }


}
